\(\int \cos (c+d x) \cot (c+d x) (a+b \sin (c+d x))^2 \, dx\) [1062]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 25, antiderivative size = 90 \[ \int \cos (c+d x) \cot (c+d x) (a+b \sin (c+d x))^2 \, dx=a b x-\frac {a^2 \text {arctanh}(\cos (c+d x))}{d}+\frac {\left (2 a^2-b^2\right ) \cos (c+d x)}{3 d}+\frac {a b \cos (c+d x) \sin (c+d x)}{3 d}+\frac {\cos (c+d x) (a+b \sin (c+d x))^2}{3 d} \]

[Out]

a*b*x-a^2*arctanh(cos(d*x+c))/d+1/3*(2*a^2-b^2)*cos(d*x+c)/d+1/3*a*b*cos(d*x+c)*sin(d*x+c)/d+1/3*cos(d*x+c)*(a
+b*sin(d*x+c))^2/d

Rubi [A] (verified)

Time = 0.19 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.240, Rules used = {2968, 3129, 3112, 3102, 2814, 3855} \[ \int \cos (c+d x) \cot (c+d x) (a+b \sin (c+d x))^2 \, dx=-\frac {a^2 \text {arctanh}(\cos (c+d x))}{d}+\frac {\left (2 a^2-b^2\right ) \cos (c+d x)}{3 d}+\frac {a b \sin (c+d x) \cos (c+d x)}{3 d}+\frac {\cos (c+d x) (a+b \sin (c+d x))^2}{3 d}+a b x \]

[In]

Int[Cos[c + d*x]*Cot[c + d*x]*(a + b*Sin[c + d*x])^2,x]

[Out]

a*b*x - (a^2*ArcTanh[Cos[c + d*x]])/d + ((2*a^2 - b^2)*Cos[c + d*x])/(3*d) + (a*b*Cos[c + d*x]*Sin[c + d*x])/(
3*d) + (Cos[c + d*x]*(a + b*Sin[c + d*x])^2)/(3*d)

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2968

Int[cos[(e_.) + (f_.)*(x_)]^2*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)
, x_Symbol] :> Int[(d*Sin[e + f*x])^n*(a + b*Sin[e + f*x])^m*(1 - Sin[e + f*x]^2), x] /; FreeQ[{a, b, d, e, f,
 m, n}, x] && NeQ[a^2 - b^2, 0] && (IGtQ[m, 0] || IntegersQ[2*m, 2*n])

Rule 3102

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Cos[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Dist[1/(
b*(m + 2)), Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x],
x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] &&  !LtQ[m, -1]

Rule 3112

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])*((A_.) + (B_.)*sin[(e
_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*d*Cos[e + f*x]*Sin[e + f*x]*((a +
 b*Sin[e + f*x])^(m + 1)/(b*f*(m + 3))), x] + Dist[1/(b*(m + 3)), Int[(a + b*Sin[e + f*x])^m*Simp[a*C*d + A*b*
c*(m + 3) + b*(B*c*(m + 3) + d*(C*(m + 2) + A*(m + 3)))*Sin[e + f*x] - (2*a*C*d - b*(c*C + B*d)*(m + 3))*Sin[e
 + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] &&
  !LtQ[m, -1]

Rule 3129

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (C_.)
*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Cos[e + f*x]*(a + b*Sin[e + f*x])^m*((c + d*Sin[e + f*x])^
(n + 1)/(d*f*(m + n + 2))), x] + Dist[1/(d*(m + n + 2)), Int[(a + b*Sin[e + f*x])^(m - 1)*(c + d*Sin[e + f*x])
^n*Simp[a*A*d*(m + n + 2) + C*(b*c*m + a*d*(n + 1)) + (A*b*d*(m + n + 2) - C*(a*c - b*d*(m + n + 1)))*Sin[e +
f*x] + C*(a*d*m - b*c*(m + 1))*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, C, n}, x] && NeQ[b*c
- a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && GtQ[m, 0] &&  !(IGtQ[n, 0] && ( !IntegerQ[m] || (EqQ[a,
 0] && NeQ[c, 0])))

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \int \csc (c+d x) (a+b \sin (c+d x))^2 \left (1-\sin ^2(c+d x)\right ) \, dx \\ & = \frac {\cos (c+d x) (a+b \sin (c+d x))^2}{3 d}+\frac {1}{3} \int \csc (c+d x) (a+b \sin (c+d x)) \left (3 a+b \sin (c+d x)-2 a \sin ^2(c+d x)\right ) \, dx \\ & = \frac {a b \cos (c+d x) \sin (c+d x)}{3 d}+\frac {\cos (c+d x) (a+b \sin (c+d x))^2}{3 d}+\frac {1}{6} \int \csc (c+d x) \left (6 a^2+6 a b \sin (c+d x)-2 \left (2 a^2-b^2\right ) \sin ^2(c+d x)\right ) \, dx \\ & = \frac {\left (2 a^2-b^2\right ) \cos (c+d x)}{3 d}+\frac {a b \cos (c+d x) \sin (c+d x)}{3 d}+\frac {\cos (c+d x) (a+b \sin (c+d x))^2}{3 d}+\frac {1}{6} \int \csc (c+d x) \left (6 a^2+6 a b \sin (c+d x)\right ) \, dx \\ & = a b x+\frac {\left (2 a^2-b^2\right ) \cos (c+d x)}{3 d}+\frac {a b \cos (c+d x) \sin (c+d x)}{3 d}+\frac {\cos (c+d x) (a+b \sin (c+d x))^2}{3 d}+a^2 \int \csc (c+d x) \, dx \\ & = a b x-\frac {a^2 \text {arctanh}(\cos (c+d x))}{d}+\frac {\left (2 a^2-b^2\right ) \cos (c+d x)}{3 d}+\frac {a b \cos (c+d x) \sin (c+d x)}{3 d}+\frac {\cos (c+d x) (a+b \sin (c+d x))^2}{3 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.42 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.01 \[ \int \cos (c+d x) \cot (c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {3 \left (4 a^2-b^2\right ) \cos (c+d x)-b^2 \cos (3 (c+d x))+6 a \left (2 b c+2 b d x-2 a \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+2 a \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+b \sin (2 (c+d x))\right )}{12 d} \]

[In]

Integrate[Cos[c + d*x]*Cot[c + d*x]*(a + b*Sin[c + d*x])^2,x]

[Out]

(3*(4*a^2 - b^2)*Cos[c + d*x] - b^2*Cos[3*(c + d*x)] + 6*a*(2*b*c + 2*b*d*x - 2*a*Log[Cos[(c + d*x)/2]] + 2*a*
Log[Sin[(c + d*x)/2]] + b*Sin[2*(c + d*x)]))/(12*d)

Maple [A] (verified)

Time = 0.32 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.80

method result size
derivativedivides \(\frac {a^{2} \left (\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )+2 a b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {b^{2} \left (\cos ^{3}\left (d x +c \right )\right )}{3}}{d}\) \(72\)
default \(\frac {a^{2} \left (\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )+2 a b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {b^{2} \left (\cos ^{3}\left (d x +c \right )\right )}{3}}{d}\) \(72\)
parallelrisch \(\frac {12 a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\cos \left (3 d x +3 c \right ) b^{2}+6 a b \sin \left (2 d x +2 c \right )+\left (12 a^{2}-3 b^{2}\right ) \cos \left (d x +c \right )+12 a b x d +12 a^{2}-4 b^{2}}{12 d}\) \(83\)
risch \(a b x +\frac {a^{2} {\mathrm e}^{i \left (d x +c \right )}}{2 d}-\frac {{\mathrm e}^{i \left (d x +c \right )} b^{2}}{8 d}+\frac {a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{2 d}-\frac {{\mathrm e}^{-i \left (d x +c \right )} b^{2}}{8 d}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}-\frac {\cos \left (3 d x +3 c \right ) b^{2}}{12 d}+\frac {a b \sin \left (2 d x +2 c \right )}{2 d}\) \(146\)
norman \(\frac {a b x +\frac {4 a^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {\left (2 a^{2}-2 b^{2}\right ) \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+a b x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {6 a^{2}-2 b^{2}}{3 d}+\frac {2 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 a b \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+3 a b x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+3 a b x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}+\frac {a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}\) \(182\)

[In]

int(cos(d*x+c)^2*csc(d*x+c)*(a+b*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*(cos(d*x+c)+ln(csc(d*x+c)-cot(d*x+c)))+2*a*b*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c)-1/3*b^2*cos(d*
x+c)^3)

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 84, normalized size of antiderivative = 0.93 \[ \int \cos (c+d x) \cot (c+d x) (a+b \sin (c+d x))^2 \, dx=-\frac {2 \, b^{2} \cos \left (d x + c\right )^{3} - 6 \, a b d x - 6 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) - 6 \, a^{2} \cos \left (d x + c\right ) + 3 \, a^{2} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - 3 \, a^{2} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{6 \, d} \]

[In]

integrate(cos(d*x+c)^2*csc(d*x+c)*(a+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/6*(2*b^2*cos(d*x + c)^3 - 6*a*b*d*x - 6*a*b*cos(d*x + c)*sin(d*x + c) - 6*a^2*cos(d*x + c) + 3*a^2*log(1/2*
cos(d*x + c) + 1/2) - 3*a^2*log(-1/2*cos(d*x + c) + 1/2))/d

Sympy [F]

\[ \int \cos (c+d x) \cot (c+d x) (a+b \sin (c+d x))^2 \, dx=\int \left (a + b \sin {\left (c + d x \right )}\right )^{2} \cos ^{2}{\left (c + d x \right )} \csc {\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)**2*csc(d*x+c)*(a+b*sin(d*x+c))**2,x)

[Out]

Integral((a + b*sin(c + d*x))**2*cos(c + d*x)**2*csc(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 74, normalized size of antiderivative = 0.82 \[ \int \cos (c+d x) \cot (c+d x) (a+b \sin (c+d x))^2 \, dx=-\frac {2 \, b^{2} \cos \left (d x + c\right )^{3} - 3 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a b - 3 \, a^{2} {\left (2 \, \cos \left (d x + c\right ) - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{6 \, d} \]

[In]

integrate(cos(d*x+c)^2*csc(d*x+c)*(a+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/6*(2*b^2*cos(d*x + c)^3 - 3*(2*d*x + 2*c + sin(2*d*x + 2*c))*a*b - 3*a^2*(2*cos(d*x + c) - log(cos(d*x + c)
 + 1) + log(cos(d*x + c) - 1)))/d

Giac [A] (verification not implemented)

none

Time = 0.45 (sec) , antiderivative size = 133, normalized size of antiderivative = 1.48 \[ \int \cos (c+d x) \cot (c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {3 \, {\left (d x + c\right )} a b + 3 \, a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - \frac {2 \, {\left (3 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 3 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 6 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, a^{2} + b^{2}\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{3}}}{3 \, d} \]

[In]

integrate(cos(d*x+c)^2*csc(d*x+c)*(a+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

1/3*(3*(d*x + c)*a*b + 3*a^2*log(abs(tan(1/2*d*x + 1/2*c))) - 2*(3*a*b*tan(1/2*d*x + 1/2*c)^5 - 3*a^2*tan(1/2*
d*x + 1/2*c)^4 + 3*b^2*tan(1/2*d*x + 1/2*c)^4 - 6*a^2*tan(1/2*d*x + 1/2*c)^2 - 3*a*b*tan(1/2*d*x + 1/2*c) - 3*
a^2 + b^2)/(tan(1/2*d*x + 1/2*c)^2 + 1)^3)/d

Mupad [B] (verification not implemented)

Time = 11.29 (sec) , antiderivative size = 225, normalized size of antiderivative = 2.50 \[ \int \cos (c+d x) \cot (c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {a^2\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (2\,a^2-2\,b^2\right )+4\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+2\,a^2-\frac {2\,b^2}{3}-2\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+2\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}+\frac {2\,a\,b\,\mathrm {atan}\left (\frac {4\,a^2\,b^2}{4\,a^3\,b-4\,a^2\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}+\frac {4\,a^3\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{4\,a^3\,b-4\,a^2\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d} \]

[In]

int((cos(c + d*x)^2*(a + b*sin(c + d*x))^2)/sin(c + d*x),x)

[Out]

(a^2*log(tan(c/2 + (d*x)/2)))/d + (tan(c/2 + (d*x)/2)^4*(2*a^2 - 2*b^2) + 4*a^2*tan(c/2 + (d*x)/2)^2 + 2*a^2 -
 (2*b^2)/3 - 2*a*b*tan(c/2 + (d*x)/2)^5 + 2*a*b*tan(c/2 + (d*x)/2))/(d*(3*tan(c/2 + (d*x)/2)^2 + 3*tan(c/2 + (
d*x)/2)^4 + tan(c/2 + (d*x)/2)^6 + 1)) + (2*a*b*atan((4*a^2*b^2)/(4*a^3*b - 4*a^2*b^2*tan(c/2 + (d*x)/2)) + (4
*a^3*b*tan(c/2 + (d*x)/2))/(4*a^3*b - 4*a^2*b^2*tan(c/2 + (d*x)/2))))/d